package exception;

public class StudentTest {

    public static void main(String[] args) {
        try {
            Student zs = new Student("张三", 18);
            zs.sayHello();

            Student ls = new Student("", 180);
            ls.sayHello();
        } catch (NameInitException ex) {
            ex.printStackTrace();
            System.out.println("请输入姓名！");
        } catch (AgeException ex) {
            ex.printStackTrace();
            System.out.println("年龄必须在18-65范围！");
        }
    }
}
